package org.bees.cms.core.content;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
public class Topic extends Content {
	private static final long serialVersionUID = -6259501113002969053L;

	private Category category;
	private Set<Article> articles = new HashSet<Article>();

	@ManyToOne(cascade = { CascadeType.REFRESH }, optional = false)
	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@OneToMany(cascade = { CascadeType.REMOVE, CascadeType.REFRESH }, mappedBy = "topic")
	public Set<Article> getArticles() {
		return articles;
	}

	public void setArticles(Set<Article> articles) {
		this.articles = articles;
	}

}
